#include "coid/svc/coidsvc.h"

//{client 
#include "coid/comm/binstream/stlstream.h"
//}client

#include "string.h"
#include <stdlib.h>


//{client 
struct cWeather
{
	int id;
	std::string city;
	float today;
	float tomorrow;
	float day_after_tomorrow;
	
	friend binstream & operator << ( binstream & out, const cWeather & x ) 	
	{ 
		return out << x.id << x.city << x.today << x.tomorrow << x.day_after_tomorrow; 
	};

    friend binstream & operator >> ( binstream & in, cWeather & x ) 
	{
		return in >> x.id >> x.city >> x.today >> x.tomorrow >> x.day_after_tomorrow;      /// notice the FIFO order (first in, first out)
    };

    friend metastream& operator << ( metastream& m, const cWeather & x )
    {
        MSTRUCT_OPEN(m,"weather");
		MM(m,"id",x.id);
		MM(m,"city",x.city);
		MM(m,"today",x.today);
		MM(m,"tomorrow",x.tomorrow);
		MM(m,"day_after_tomorrow",x.day_after_tomorrow);
		MSTRUCT_CLOSE(m);
    }

};
//}client


class interactivTable
{
	int row_count;
	std::vector< cWeather > WeatherTable;

public:
	interactivTable();

	~interactivTable();

	net_fnc_s net_meta opcd accept_connect();

	// get whole table
	net_fnc net_meta opcd get_table( net_out std::vector< cWeather > & weather_table );

	//get only changed rows
	net_fnc net_meta opcd get_change( net_out std::vector< cWeather >  & changed_rows );

};